﻿	

#region Using Directives
using System;
using System.ComponentModel;
using System.Collections;
using System.Xml.Serialization;
using System.Data;
using NetROS.Tiers.Data.Bases;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Entities.Validation;

using NetROS.Tiers.Data;
using Microsoft.Practices.EnterpriseLibrary.Logging;

#endregion

namespace NetROS.Tiers.Services
{		
	
	///<summary>
	/// An component type implementation of the 'tblPutniNalog' table.
	///</summary>
	/// <remarks>
	/// All custom implementations should be done here.
	/// </remarks>
	[CLSCompliant(true)]
	public partial class PutniNalogService : NetROS.Tiers.Services.PutniNalogServiceBase
	{
		/// <summary>
		/// Initializes a new instance of the PutniNalogService class.
		/// </summary>
		public PutniNalogService() : base()
		{
		}
        private static readonly bool noTranByDefaultsecond = false;
        private static readonly string layerExceptionPolicysecond = "NoneExceptionPolicy";

        [DataObjectMethod(DataObjectMethodType.Select)]
		public virtual DataTable GetDistinctRelacijaOd()
		{
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetDistinctRelacijaOd");
            //totalCount = -1;
			
			DataTable entity = null;
			TransactionManager transactionManager = null; 
			
			try
            {	
				//since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
				 transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefaultsecond);
				NetTiersProvider dataProvider = ConnectionScope.Current.DataProvider;					
				
				//Access Repository
				entity = dataProvider.PutniNalogProvider.GetDistinctRelacijaOd(transactionManager);
			
				//if borrowed tran, leave open for next call
				
			}
            catch (Exception exc)
            {
				//if open, rollback, it's possible this is part of a larger commit
                if (transactionManager != null && transactionManager.IsOpen) 
					transactionManager.Rollback();
				
				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicysecond)) 
					throw;
			}
			return entity;
		}
		
         [DataObjectMethod(DataObjectMethodType.Select)]
		public virtual DataTable GetDistinctRelacijaDo()
		{
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetDistinctRelacijaDo");
            //totalCount = -1;
			
			DataTable entity = null;
			TransactionManager transactionManager = null; 
			
			try
            {	
				//since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
				 transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefaultsecond);
				NetTiersProvider dataProvider = ConnectionScope.Current.DataProvider;					
				
				//Access Repository
				entity = dataProvider.PutniNalogProvider.GetDistinctRelacijaDo(transactionManager);
			
				//if borrowed tran, leave open for next call
				
			}
            catch (Exception exc)
            {
				//if open, rollback, it's possible this is part of a larger commit
                if (transactionManager != null && transactionManager.IsOpen) 
					transactionManager.Rollback();
				
				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicysecond)) 
					throw;
			}
			return entity;
		}
	}//End Class




} // end namespace
